﻿using System;
using System.Collections.Generic;
using System.Text;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
namespace Utility.Extensions
{
    /// <summary>
    /// Vue-Admin-Element UI 前端数据返回
    /// </summary>
    public static class VueAdminElementApiResult
    {
        /// <summary>
        /// 返回 Vue-Admin-Element Api 格式结果
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="code"></param>
        /// <returns></returns>
        public static VueAdminElementApiResultClass ToApiResult(this object obj, int code = 20000)
        {
            return new VueAdminElementApiResultClass
            {
                code = code,
                data = obj
            };
        }
    }
    public class VueAdminElementApiResultClass
    {
        /// <summary>
        /// 20000 为正常
        /// </summary>
        public int code { get; set; }
        /// <summary>
        /// 返回的数据内容
        /// </summary>
        public dynamic data { get; set; }
    }
}
